local skel = fk.CreateSkill {
  name = "emo__zhiwang",
  tags = {Skill.Compulsory},
}

skel:addEffect(fk.AfterCardsMove, {
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and player:isKongcheng() and #player:getTableMark("@$emo__zhiwang") > 0 then
      for _, move in ipairs(data) do
        if move.from == player then
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Player.Hand then
              return true
            end
          end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:setPlayerMark(player, "@$emo__zhiwang", 0)
  end,
})

skel:addEffect(fk.AfterCardUseDeclared, {
  can_refresh = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player
  end,
  on_refresh = function (self, event, target, player, data)
    player.room:addTableMarkIfNeed(player, "@$emo__zhiwang", data.card.trueName)
  end,
})

skel:addEffect("prohibit", {
  prohibit_use = function(self, player, card)
    return player:hasSkill(skel.name) and card and table.contains(player:getTableMark("@$emo__zhiwang"), card.trueName)
  end,
})

skel:addLoseEffect(function (self, player, is_death)
  player.room:setPlayerMark(player, "@$emo__zhiwang", 0)
end)

Fk:loadTranslationTable{
  ["emo__zhiwang"] = "执妄",
  [":emo__zhiwang"] = "锁定技，当你使用一张牌时，记录之，你不能使用与记录牌名相同的牌。每当你失去手牌后，若你没有手牌，你清除牌名记录。",
  ["@$emo__zhiwang"] = "执妄",
}


return skel
